import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

import Layout from '../views/layout/Layout'

export const constantRouterMap = [
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  {
    path: '/404',
    component: () => import('@/views/404'),
    hidden: true
  },

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    name: 'Dashboard',
    hidden: true,
    children: [
      {
        path: 'dashboard',
        component: () => import('@/views/dashboard/index')
      }
    ]
  },
  // {
  //   path: '/test',
  //   component: Layout,
  //   children: [
  //     {
  //       path: '/testList',
  //       name: 'TestList',
  //       component: () => import('@/views/test/TestList'),
  //       meta: {
  //         permission: 1,
  //         title: '试卷管理',
  //         icon: 'signUp',
  //         affix: true
  //       }
  //     },
  //     {
  //       path: '/testInfo',
  //       name: 'TestInfo',
  //       hidden: true,
  //       component: () => import('@/views/test/TestInfo'),
  //       meta: {
  //         permission: 2,
  //         title: '试卷详情',
  //         icon: 'signUp',
  //         noCache: true
  //       }
  //     }
  //   ]
  // },
  {
    path: '/question',
    component: Layout,
    children: [
      {
        path: '/questionList',
        name: 'QuestionList',
        component: () => import('@/views/question/QuestionList'),
        meta: {
          permission: 4,
          title: '题目管理',
          icon: 'question'
        }
      },
      {
        path: '/questionInfo',
        name: 'QuestionInfo',
        hidden: true,
        component: () => import('@/views/question/QuestionInfo'),
        meta: {
          permission: 8,
          noCache: true,
          title: '题目信息',
          icon: 'question'
        }
      }
    ]
  },
  {
    path: '/work/questionList',
    name: 'QuestionList',
    component: () => import('@/views/work/QuestionList'),
    meta: {
      permission: 4,
      title: '题目管理',
      noCache: true,
      icon: 'question'
    }
  },
  // {
  //   path: '/chinese',
  //   component: Layout,
  //   children: [
  //     {
  //       path: '/chinese',
  //       name: 'Chinese',
  //       component: () => import('@/views/test/chinese/Chinese'),
  //       meta: {
  //         permission: 1,
  //         title: '语文题目',
  //         noCache: true,
  //         icon: 'signUp',
  //         affix: true
  //       }
  //     }
  //   ]
  // },
  // {
  //   path: '/mathematics',
  //   component: Layout,
  //   children: [
  //     {
  //       path: '/mathematics',
  //       name: 'Mathematics',
  //       component: () => import('@/views/test/mathematics/Mathematics'),
  //       meta: {
  //         permission: 1,
  //         title: '数学题目',
  //         noCache: true,
  //         icon: 'signUp',
  //         affix: true
  //       }
  //     }
  //   ]
  // },
  {
    path: '/work/questionInfo',
    name: 'QuestionInfo',
    hidden: true,
    component: () => import('@/views/work/QuestionInfo'),
    meta: {
      permission: 8,
      noCache: true,
      title: '题目信息',
      icon: 'question'
    }
  },
  {
    path: '/work/test/testInfo',
    name: 'TestInfo',
    hidden: true,
    component: () => import('@/views/work/test/TestInfo'),
    meta: {
      permission: 8,
      noCache: true,
      title: '试卷信息',
      icon: 'question'
    }
  },
  {
    path: '/work/test/QuestionInfo',
    name: 'TestQuestionInfo',
    hidden: true,
    component: () => import('@/views/work/test/QuestionInfo'),
    meta: {
      permission: 8,
      noCache: true,
      title: '题目信息',
      icon: 'question'
    }
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRouterMap
})

export const asynRouterMap = [
  {
    // 题库管理 lzr
    path: '/statistics',
    component: Layout,
    meta: {
      title: '运营统计',
      icon: 'signUp'
    },
    children: [
      {
        path: '/StatisticsQuestionList',
        name: 'StatisticsQuestionList',
        component: () => import('@/views/statistics/StatisticsQuestionList'),
        meta: {
          permission: 4,
          title: '题库做题统计',
          noCache: true
        }
      },
      {
        path: '/StatisticsQuestionInfo',
        name: 'StatisticsQuestionInfo',
        hidden: true,
        component: () => import('@/views/statistics/StatisticsQuestionInfo'),
        meta: {
          permission: 2,
          title: '题库做题详情',
          icon: 'signUp',
          noCache: true
        }
      },
      {
        path: '/StatisticsUserList',
        name: 'StatisticsUserList',
        component: () => import('@/views/statistics/StatisticsUserList'),
        meta: {
          permission: 4,
          title: '用户做题统计',
          noCache: true
        }
      },
      {
        path: '/StatisticsUserInfo',
        name: 'StatisticsUserInfo',
        hidden: true,
        component: () => import('@/views/statistics/StatisticsUserInfo'),
        meta: {
          permission: 2,
          title: '用户做题详情',
          icon: 'signUp',
          noCache: true
        }
      },
    
    ]
    }
  ,
  {
    path: '/spotCheck',
    component: Layout,
    meta: {
      title: '题库抽检',
      icon: 'word'
    },
    children: [
      {
        path: '/spotCheck/questionList',
        name: 'QuestionList',
        component: () => import('@/views/spotCheck/QuestionList'),
        meta: {
          permission: 4,
          title: '题目抽检',
          noCache: true
        }
      },
      {
        path: '/spotCheck/questionInfo',
        name: 'questionInfo',
        component: () => import('@/views/spotCheck/QuestionInfo'),
        hidden: true,
        meta: {
          permission: 4,
          title: '题目抽检',
          noCache: true
        }
      },
      {
        path: '/spotCheck/sample',
        name: 'sample',
        component: () => import('@/views/spotCheck/Sample'),
        meta: {
          permission: 4,
          title: '抽样池',
          noCache: true
        }
      },
      {
        path: '/spotCheck/batchList',
        name: 'batchList',
        component: () => import('@/views/spotCheck/BatchList'),
        meta: {
          permission: 4,
          title: '批次记录',
          noCache: true
        }
      },
      {
        path: '/spotCheck/sampleLog',
        name: 'sampleLog',
        component: () => import('@/views/spotCheck/SampleLog'),
        meta: {
          permission: 4,
          title: '抽检记录',
          noCache: true
        }
      }
    ]
  },
  {
    // 题库管理 lzr
    path: '/tiku',
    component: Layout,
    meta: {
      title: '题库管理',
      icon: 'signUp'
    },
    children: [
      {
        path: '/tiku',
        name: 'QuestionList',
        component: () => import('@/views/tiku/index'),
        meta: {
          permission: 4,
          title: '题目上架',
          noCache: true
        }
      },
      {
        path: '/sjjoin',
        name: 'sjjoin',
        hidden: false,
        component: () => import('@/views/tiku/sjjoin'),
        meta: {
          permission: 5,
          noCache: true,
          title: '试卷上架',
          icon: ''
        }
      },
      {
        path: '/TMget',
        name: 'TMget',
        hidden: false,
        component: () => import('@/views/tiku/TMget'),
        meta: {
          permission: 6,
          noCache: true,
          title: '题目管理',
          icon: ''
        }
      },
      {
        path: '/QuestionErrorCorrection',
        name: 'QuestionErrorCorrection',
        hidden: false,
        component: () => import('@/views/tiku/QuestionErrorCorrection'),
        meta: {
          permission: 6,
          noCache: true,
          title: '题目纠错',
          icon: ''
        }
      },
      {
        path: '/SJget',
        name: 'SJget',
        hidden: false,
        component: () => import('@/views/tiku/SJget'),
        meta: {
          permission: 7,
          noCache: true,
          title: '试卷管理',
          icon: ''
        }
      },
      {
        path: '/TMStatistics',
        name: 'TMStatistics',
        hidden: false,
        component: () => import('@/views/tiku/TMStatistics'),
        meta: {
          permission: 8,
          noCache: true,
          title: '题目录题统计',
          icon: ''
        }
      },
      {
        path: '/SJStatistics',
        name: 'SJStatistics',
        hidden: false,
        component: () => import('@/views/tiku/SJStatistics'),
        meta: {
          permission: 9,
          noCache: true,
          title: '试卷录题统计',
          icon: ''
        }
      },
      {
        // lzr
        path: '/indedetail',
        name: 'indedetail',
        hidden: true,
        component: () => import('@/views/tiku/indedetail'),
        meta: {
          permission: 2,
          title: '题目上架详情',
          icon: 'signUp',
          noCache: true
        }
      }
    ]
  }
]
